package com.neuedu.his.controller;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.neuedu.his.po.Checkapply;

import com.neuedu.his.po.Department;
import com.neuedu.his.po.Fmeditem;
import com.neuedu.his.service.CheckapplyService;
import com.neuedu.his.service.FmeditemService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/check")
public class CheckApplyController {

    @Autowired
    CheckapplyService service;

    @RequestMapping("/getbymid")
    public Map<String,Object> getbymid(@RequestParam Integer mid){
        return service.getinfoAndPriceByMedicalID(mid);
    }

    @RequestMapping("/saveOrUpdate")
    public boolean saveOrUpdate(@RequestParam Integer id){
        Checkapply checkapply= service.getById(id);
        checkapply.setState(2);
        return service.saveOrUpdate(checkapply);
    }

    @RequestMapping("/add")
    public boolean add(@RequestBody Checkapply c){
        System.out.println(c);
        return service.saveOrUpdate(c);
    }


    @RequestMapping("/getbyregistid")
    public List<Checkapply> getbyregistid(@RequestParam Integer id){
        return service.listWithDeptname(id);
    }
}